<%@page import="
    org.apache.sling.api.resource.Resource,
    org.apache.sling.api.resource.ValueMap"
%><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0"%><%
%><sling:defineObjects/><%

ValueMap properties = resource.adaptTo(ValueMap.class);

%>
<article class="movie">
    <a href="<%= resource.getPath() %>.html"><img class="movie-poster" src="<%= properties.get("poster", "") %>" alt="<%= properties.get("title", "") %>" /></a>
    
    <h2 class="movie-title"><a href="<%= resource.getPath() %>.html"><%= properties.get("title", "") %></a></h2>
    
    <section class="movie-year">
        <h3>Year</h3>
        <p><%= properties.get("year", "") %></p>
    </section>
    
    <section class="movie-runtime">
        <h3>Runtime</h3>
        <p><%= properties.get("runtime", "") %></p>
    </section>
    
    <section class="movie-cast">
        <h3>Cast</h3>
        <% String[] cast = properties.get("cast", String[].class); %>
        <ul class="movie-cast-list">
            <% for (String actor : cast) { %>
                <li class="movie-cast-item"><%= actor %></li>
            <% } %>
        </ul>
    </section>
</article>
